import time

def bubble_sort(c):

    a = True
    while a:
        a = False
        for i in range(len(c) - 1):
            if c[i] > c[i + 1]:
                c[i], c[i + 1] = c[i + 1], c[i]

                a = True

def read2list(filename):
    file = open(filename, 'r')
    data = file.readlines()
    return data

m1 = read2list("m1_sorted.txt")
m2 = read2list("m2_reverse.txt")
m3 = read2list("m3_shuffle.txt")

b = time.time()
bubble_sort(m1)
f = time.time()
print("m1_sorted",round((f-b)*1000),"milliseconds")

b = time.time()
bubble_sort(m2)
f = time.time()
print("m2_reverse",round((f-b)*1000),"milliseconds")

b = time.time()
bubble_sort(m3)
f = time.time()
print("m3_shuffle",round((f-b)*1000),"milliseconds")
